<template>
  <div id="main-nav" class="navbar navbar-fixed-top scrolled" style="top: 0px;">
    <div class="container">

      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#site-nav">
          <span class="sr-only">菜单</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <span class="navbar-brand scrollto visible-xs" @click="toDiv('home')"><img width="70px" :src="logo"></span>
      </div>

      <div id="site-nav" class="navbar-collapse collapse">
        <ul class="nav navbar-center navbar-nav">
          <li class="logo visible-sm visible-md visible-lg active">
            <a class="scrollto" @click="toDiv('home')"></a>
            <img :src="logo" width="140px">
          </li>
          <li class="sub" v-for="item in menu" v-if="item.children.length === 0">
            <a @click="toDiv(item.url)" v-if="item.linkType == 1">{{ item.label }}</a>
            <a :href="item.url" v-if="item.linkType == 2">{{ item.label }}</a>
          </li>
          <li class="sub dropdown" v-else>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
              {{ item.label }} <span class="caret"></span>
            </a>
            <ul class="dropdown-menu" role="menu">
              <li v-for="ii in item.children">
                <!--外链-->
                <span v-if="ii.linkType == 2">
                     <a :href="ii.url" target="_blank" >
                      <img :src="ii.label" v-if="ii.labelType == 'img'">
                       <span v-if="ii.labelType == 'text'">{{ii.label}}</span>
                    </a>
                </span>

                <!--滚动-->
                <span v-if="ii.linkType == 1" @click="toDiv(ii.url)">
                    <img :src="ii.label" v-if="ii.labelType == 'img'" >
                    <a v-if="ii.labelType == 'text'">{{ ii.label }}</a>
                </span>

                <!--无链接-->
                <span v-if="ii.linkType == 3">
                    <img :src="ii.label" v-if="ii.labelType == 'img'">
                    <a v-if="ii.labelType == 'text'">{{ ii.label }}</a>
                </span>

              </li>
            </ul>
          </li>
        </ul>
      </div>
      <!--End navbar-collapse -->

    </div>
    <!--End container -->

  </div>
</template>

<script>

export default {
  props:{
    logo:'',
    menu:[],
  },
  components: {

  },
  computed: {

  },
  methods: {
    toDiv(name){
      this.$emit('toDiv',name)
    },
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>



</style>

